<!--
 * @Author: your name
 * @Date: 2021-12-15 20:24:53
 * @LastEditTime: 2021-12-16 20:22:54
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \day7\my-app\src\components\Left.vue
-->
/<template>
  <ul class="left">
    <li
      v-for="(item, index) in list"
      :key="index"
      :style="{ color: activeIndex == index ? 'red' : '' }"
      @click="toscroll(index)"
    >
      {{ item.name }}
    </li>
  </ul>
</template>

<script>
export default {
  props: ["list", "activeIndex", "toIndex"],
  methods: {
    toscroll(index) {
      this.bus.$emit("aa", index);
      this.bus.$emit("changeIndex", index);
    },
  },
};
</script>

<style lang="scss" scoped>
.left {
  text-align: center;
  line-height: 45px;
}
</style>